home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIRDFService.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  153 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39. #include "nsIRDFResource.idl"
  40. #include "nsIRDFLiteral.idl"
  41. #include "nsIRDFDataSource.idl"
  42.  
  43.  
  44. // The RDF service interface. This is a singleton object, and should be
  45. // obtained from the <tt>nsServiceManager</tt>.
  46. [scriptable, uuid(BFD05261-834C-11d2-8EAC-00805F29F370)]
  47. interface nsIRDFService : nsISupports {
  48.     // Construct an RDF resource from a single-byte URI. <tt>nsIRDFSerivce</tt>
  49.     // caches resources that are in-use, so multiple calls to <tt>GetResource()</tt>
  50.     // for the same <tt>uri</tt> will return identical pointers. FindResource
  51.     // is used to find out whether there already exists a resource corresponding to that url.
  52.     nsIRDFResource GetResource(in AUTF8String aURI);
  53.  
  54.     // Construct an RDF resource from a Unicode URI. This is provided
  55.     // as a convenience method, allowing automatic, in-line C++
  56.     // conversion from <tt>nsString</tt> objects. The <tt>uri</tt> will
  57.     // be converted to a single-byte representation internally.
  58.     nsIRDFResource GetUnicodeResource(in AString aURI);
  59.  
  60.     nsIRDFResource GetAnonymousResource();
  61.  
  62.     // Construct an RDF literal from a Unicode string.
  63.     nsIRDFLiteral  GetLiteral(in wstring aValue);
  64.  
  65.     // Construct an RDF literal from a PRTime.
  66.     nsIRDFDate     GetDateLiteral(in long long aValue);
  67.  
  68.     // Construct an RDF literal from an int.
  69.     nsIRDFInt      GetIntLiteral(in long aValue);
  70.  
  71.     // Construct an RDF literal from a data blob
  72.     [noscript] nsIRDFBlob getBlobLiteral(in const_octet_ptr aValue, in long aLength);
  73.  
  74.     boolean IsAnonymousResource(in nsIRDFResource aResource);
  75.  
  76.     // Registers a resource with the RDF system, making it unique w.r.t.
  77.     // GetResource.
  78.     //
  79.     // An implementation of nsIRDFResource should call this in its
  80.     // Init() method if it wishes the resource to be globally unique
  81.     // (which is usually the case).
  82.     //
  83.     // NOTE that the resource will <i>not</i> be ref-counted by the
  84.     // RDF service: the assumption is that the resource implementation
  85.     // will call nsIRDFService::UnregisterResource() when the last
  86.     // reference to the resource is released.
  87.     //
  88.     // NOTE that the nsIRDFService implementation may choose to
  89.     // maintain a reference to the resource's URI; therefore, the
  90.     // resource implementation should ensure that the resource's URI
  91.     // (accessable via nsIRDFResource::GetValue(const char* *aURI)) is
  92.     // valid before calling RegisterResource(). Furthermore, the
  93.     // resource implementation should ensure that this pointer
  94.     // <i>remains</i> valid for the lifetime of the resource. (The
  95.     // implementation of the resource cache in nsIRDFService uses the
  96.     // URI maintained "internally" in the resource as a key into the
  97.     // cache rather than copying the resource URI itself.)
  98.     void RegisterResource(in nsIRDFResource aResource, in boolean aReplace);
  99.  
  100.     // Called to notify the resource manager that a resource is no
  101.     // longer in use. This method should only be called from the
  102.     // destructor of a "custom" resource implementation to notify the
  103.     // RDF service that the last reference to the resource has been
  104.     // released, so the resource is no longer valid.
  105.     //
  106.     // NOTE. As mentioned in nsIRDFResourceFactory::CreateResource(),
  107.     // the RDF service will use the result of
  108.     // nsIRDFResource::GetValue() as a key into its cache. For this
  109.     // reason, you must always un-cache the resource <b>before</b>
  110.     // releasing the storage for the <tt>const char*</tt> URI.
  111.     void UnregisterResource(in nsIRDFResource aResource);
  112.  
  113.     // Register a <i>named data source</i>. The RDF service will call
  114.     // <tt>nsIRDFDataSource::GetURI()</tt> to determine the URI under
  115.     // which to register the data source.
  116.     //
  117.     // Note that the data source will <i>not</i> be refcounted by the
  118.     // RDF service! The assumption is that an RDF data source
  119.     // registers with the service once it is initialized (via
  120.     // <tt>nsIRDFDataSource::Init()</tt>), and unregisters when the
  121.     // last reference to the data source is released.
  122.     void RegisterDataSource(in nsIRDFDataSource aDataSource,
  123.                             in boolean          aReplace);
  124.  
  125.     // Unregister a <i>named data source</i>. The RDF service will call
  126.     // <tt>nsIRDFDataSource::GetURI()</tt> to determine the URI under which the
  127.     // data source was registered.
  128.     void UnregisterDataSource(in nsIRDFDataSource aDataSource);
  129.  
  130.     // Get the <i>named data source</i> corresponding to the URI. If a data
  131.     // source has been registered via <tt>RegisterDataSource()</tt>, that
  132.     // data source will be returned.
  133.     //
  134.     // If no data source is currently
  135.     // registered for the specified URI, and a data source <i>constructor</i>
  136.     // function has been registered via <tt>RegisterDatasourceConstructor()</tt>,
  137.     // the RDF service will call the constructor to attempt to construct a
  138.     // new data source. If construction is successful, the data source will
  139.     // be initialized via <tt>nsIRDFDataSource::Init()</tt>.
  140.     nsIRDFDataSource GetDataSource(in string aURI);
  141.  
  142.     // Same as GetDataSource, but if a remote/XML data source needs to be
  143.     // constructed, then this method will issue a <b>blocking</b> Refresh
  144.     // call on that data source.
  145.     nsIRDFDataSource GetDataSourceBlocking(in string aURI);
  146. };
  147.  
  148. %{C++
  149. extern nsresult
  150. NS_NewRDFService(nsIRDFService** result);
  151. %}
  152.  
  153.